package com.sdslzyxyhtgl.modules.xygk.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.sdslzyxyhtgl.modules.xygk.entity.MapEntity;
import com.sdslzyxyhtgl.modules.xygk.service.MapService;
import com.sdslzyxyhtgl.common.utils.PageUtils;
import com.sdslzyxyhtgl.common.utils.R;



/**
 * 
 *
 * @author wujunfeng
 * @email 2223098767@qq.com
 * @date 2022-05-27 10:33:41
 */
@RestController
@RequestMapping("xygk/map")
public class MapController {
    @Autowired
    private MapService mapService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("xygk:map:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = mapService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("xygk:map:info")
    public R info(@PathVariable("id") Integer id){
		MapEntity map = mapService.getById(id);

        return R.ok().put("map", map);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("xygk:map:save")
    public R save(@RequestBody MapEntity map){
		mapService.save(map);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("xygk:map:update")
    public R update(@RequestBody MapEntity map){
		mapService.updateById(map);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("xygk:map:delete")
    public R delete(@RequestBody Integer[] ids){
		mapService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
